var deployItemCount:Number;
var deployItemTotal:Number=4;

function init()
{
	var cont:String=Packages.system.MLF.scanDictionary(Packages.components.ReadingRecorder.recorderMain, "processResult11");
	Packages.components.ReadingRecorder.refreshResultContent(cont, false);
	var hlp:String=Packages.system.MLF.scanDictionary(Packages.components.ReadingRecorder.recorderMain, "recordHelpContent06");
	Packages.components.ReadingRecorder.refreshHelpContent(hlp);

	// Packages.task.Processor.complete();
	// do publish
	deployItemCount=0;
	publishReadingMaterial();
}

function pressAction(param, data, slot)
{
	Packages.system.Platform.highlightBG(mlf.mcmanager.PathResolver.extractPath(param), mlf.gatekeeper.native.Caller.scanElement(slot, "highlightBg"), 100);	
}

function rolloverAction(param, data, slot)
{
	// mlf.mcmanager.PathResolver.extractPath(param+"Bg")._visible=false;
	Packages.system.Platform.highlightBG(mlf.mcmanager.PathResolver.extractPath(param), mlf.gatekeeper.native.Caller.scanElement(slot, "highlightBg"), 50);	
}

function rolloutAction(param, data, slot)
{
	// mlf.mcmanager.PathResolver.extractPath(param+"Bg")._visible=true;
	Packages.system.Platform.highlightBG(mlf.mcmanager.PathResolver.extractPath(param), mlf.gatekeeper.native.Caller.scanElement(slot, "highlightBg"), 0);	
}

function releaseAction(param, data, slot)
{
	trace("param: "+param);
	rolloutAction(param, data, slot);
	Packages.task.Composition.clear();
	Packages.task.Processor.clear();
	if (param.indexOf("browser")>-1)
	{
		Packages.components.Scene.container2Scene("ReadingRecorder", slot, "ReadingBrowser");
	}
	else if (param.indexOf("player")>-1)
	{
		Packages.components.Scene.container2Scene("ReadingRecorder", slot, "Player");
	}
	else if (param.indexOf("recorder")>-1)
	{
		Packages.components.Scene.container2Scene("ReadingRecorder", slot, "ReadingRecorder");
	}
}

function publishReadingMaterial()
{
	Packages.system.MLF.addListener("onPublishReadingMaterial", this);
	Packages.task.Processor.publish();
}

function onPublishReadingMaterial(obj)
{
	var rstHint=mlf.gatekeeper.native.Caller.scanElement("Report", obj.scope+"rstHint");
	rstHint.text=Packages.system.MLF.scanDictionary(rstHint, obj.result);
	deployItemCount++;
	var allHint=mlf.gatekeeper.native.Caller.scanElement("Report", "allrstHint");
	if (deployItemCount==deployItemTotal)
	{
		allHint.text=Packages.system.MLF.scanDictionary(allHint, "Done");
	}
	else allHint.text=deployItemCount+" / "+deployItemTotal;
}